<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/admintemplate.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ListStudentsTitle}"></h:outputText>
        </ui:define>
        <ui:define name="leftmenu">
            <h:form>
                <ul class="section menu">
                    <li><a class="menuitem">#{bundle.ControlPanelMenu}</a>
                        <ul class="submenu">
                            <li><h:commandLink action="#{courseController.prepareCreate}" value="#{bundle.ListCourseCreateLink}"/> </li>
                            <li><h:commandLink action="#{courseController.prepareList}" value="#{bundle.CreateCourseShowAllLink}" immediate="true"/> </li>
                        </ul>
                    </li>
                </ul>
            </h:form>
        </ui:define>
        <ui:define name="content">
            <h2>#{bundle.ListCourseTitle}</h2>
            <div class="block">
                <h:form>
                    <h:panelGroup id="messagePanel" layout="block">
                        <h:messages errorStyle="color: red" infoStyle="color: green" layout="list"/>
                    </h:panelGroup>
                    <h:outputText escape="false" value="#{bundle.ListStudentsEmpty}" rendered="#{studentsController.items.rowCount == 0}"/>
                    <h:panelGroup rendered="#{studentsController.items.rowCount > 0}">
                        <div class="tablePaging">
                            <h:outputText value="Showing #{studentsController.pagination.pageFirstItem + 1} to #{studentsController.pagination.pageLastItem + 1} of #{studentsController.pagination.itemsCount} entries"/>&nbsp;
                            <h:commandLink action="#{studentsController.previous}" class="btn-icon btn-teal btn-arrow-left btn-small" rendered="#{studentsController.pagination.hasPreviousPage}">
                                <span></span>
                                #{bundle.Previous} #{studentsController.pagination.pageSize}
                            </h:commandLink>&nbsp;
                            <h:commandLink action="#{studentsController.next}" class="btn-icon btn-teal btn-arrow-right btn-small" rendered="#{studentsController.pagination.hasNextPage}">
                                <span></span>
                                #{bundle.Next} #{studentsController.pagination.pageSize}
                            </h:commandLink>&nbsp;
                        </div>
                        <h:dataTable value="#{studentsController.items}" class="CSSTableGenerator" var="item" border="0" cellpadding="2" cellspacing="0"  rules="all">
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListStudentsTitle_studentId}"/>
                                </f:facet>
                                <h:outputText value="#{item.studentId}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListStudentsTitle_userName}"/>
                                </f:facet>
                                <h:outputText value="#{item.userName}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListStudentsTitle_fullName}"/>
                                </f:facet>
                                <h:outputText value="#{item.fullName}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListStudentsTitle_address}"/>
                                </f:facet>
                                <h:outputText value="#{item.address}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListStudentsTitle_dateOfBirth}"/>
                                </f:facet>
                                <h:outputText value="#{item.dateOfBirth}">
                                    <f:convertDateTime pattern="MM/dd/yyyy" />
                                </h:outputText>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListStudentsTitle_gender}"/>
                                </f:facet>
                                <h:outputText value="#{item.gender}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListStudentsTitle_email}"/>
                                </f:facet>
                                <h:outputText value="#{item.email}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListStudentsTitle_phone}"/>
                                </f:facet>
                                <h:outputText value="#{item.phone}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.CreateClassesTitle_className}"/>
                                </f:facet>
                                <h:outputText value="#{item.classId.className}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="&nbsp;"/>
                                </f:facet>
                                <h:commandLink action="#{studentsController.prepareView}" value="#{bundle.ListStudentsViewLink}"/>
                                <h:outputText value=" "/>
                                <h:commandLink action="#{studentsController.prepareEdit}" value="#{bundle.ListStudentsEditLink}"/>
                                <h:outputText value=" "/>
                                <h:commandLink action="#{studentsController.destroy}" value="#{bundle.ListStudentsDestroyLink}"/>
                            </h:column>
                        </h:dataTable>
                    </h:panelGroup>
                </h:form>
            </div>
        </ui:define>
    </ui:composition>

</html>
